<?php
// 应用公共文件
function get_str_time_simple ($targetTime) {
    // 今天最大时间
    $todayLast = strtotime(date('Y-m-d 23:59:59'));
    $agoTime = $todayLast - $targetTime;
    $agoDay = floor($agoTime / 86400);
    if ($agoDay == 0) {
        $result = '今日 ' . date('H:i', $targetTime);
    } else {
        $format = date('Y') != date('Y', $targetTime) ? "Y-m-d H:i" : "m-d H:i";
        $result = date($format, $targetTime);
    }
    return $result;
}

function join_paths (...$parts): string {
    if (sizeof($parts) === 0) return '';
    $prefix = ($parts[0] === DIRECTORY_SEPARATOR) ? DIRECTORY_SEPARATOR : '';
    $processed = array_filter(array_map(function ($part) {
        return rtrim($part, DIRECTORY_SEPARATOR);
    }, $parts), function ($part) {
        return !empty($part);
    });
    return $prefix . implode(DIRECTORY_SEPARATOR, $processed);
}
